package com.gwlc.config.admin;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * <p>script-control-com.dawn.config-WevMvcConfig</p>
 * <p>Description:  </p>
 * <p>Copyright: Copyright (c) 2021</p>
 * <p>Company: hanchunit@163.com</p>
 *
 * @author hanchun
 * @version 1.0
 * @date
 */

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        //配置跨域
        registry.addMapping("/**");
    }

//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        /*
//         * 说明：增加虚拟路径(经过本人测试：在此处配置的虚拟路径，用springboot内置的tomcat时有效，
//         * 用外部的tomcat也有效;所以用到外部的tomcat时不需在tomcat/config下的相应文件配置虚拟路径了,阿里云linux也没问题)
//         */
//        //Windows下
//        //明日方舟文件路径
//        registry.addResourceHandler(MorningBreezeImageConfig.getSrcPath() + "/**").addResourceLocations("file:" + MorningBreezeImageConfig.getSavaPath());
//        //Mac或Linux下(没有CDEF盘符)
//        // registry.addResourceHandler("/uploads/**").addResourceLocations("file:/Users/liuyanzhao/Documents/uploads/");
//        // super.addResourceHandlers(registry);
//    }
//
//    @Bean
//    public HandlerInterceptor getUserInterceptor() {
//        return new FileHandlerInterceptor();
//    }
//
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(getUserInterceptor()).addPathPatterns(MorningBreezeImageConfig.getSrcPath() + "/**").excludePathPatterns(MorningBreezeImageConfig.getSrcPath() + "/software/**");
//
//    }

}
